﻿using HZU.ZP.Data.Interfaces;
using HZU.ZP.Data.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace HZU.ZP.Data.Impl
{
    public class CompanyInformationDao : ICompanyInformationDao
    {
        private EFCoreDbContext _context;
        public CompanyInformationDao(EFCoreDbContext context)
        {
            _context = context;
        }
        public void Add(CompanyInformation companyInformation)
        {
            _context.CompanyInformations.Add(companyInformation);
            _context.SaveChanges();
        }

        public CompanyInformation Get(int companyId)
        {
            return _context.CompanyInformations.FirstOrDefault(e => e.CompanyId == companyId);
        }

        public void Update(CompanyInformation companyInformation)
        {
            _context.CompanyInformations.Update(companyInformation);
            _context.SaveChanges();
        }
    }
}
